// 组件样式文件

// 按钮组件样式
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $button-padding-vertical $button-padding-horizontal;
  font-size: $button-font-size;
  font-weight: $button-font-weight;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: $button-border-radius;
  cursor: pointer;
  transition: $transition-base;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  
  &:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba($color-primary, 0.2);
  }
  
  &.is-disabled,
  &[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
  }
  
  // 按钮尺寸
  &.btn-large {
    padding: ($button-padding-vertical + 4px) ($button-padding-horizontal + 8px);
    font-size: $font-size-large;
  }
  
  &.btn-small {
    padding: ($button-padding-vertical - 4px) ($button-padding-horizontal - 8px);
    font-size: $font-size-small;
  }
  
  &.btn-mini {
    padding: ($button-padding-vertical - 6px) ($button-padding-horizontal - 12px);
    font-size: $font-size-extra-small;
  }
  
  // 按钮类型
  &.btn-primary {
    @include button-variant($bg-color, $color-primary);
  }
  
  &.btn-success {
    @include button-variant($bg-color, $color-success);
  }
  
  &.btn-warning {
    @include button-variant($bg-color, $color-warning);
  }
  
  &.btn-danger {
    @include button-variant($bg-color, $color-danger);
  }
  
  &.btn-info {
    @include button-variant($bg-color, $color-info);
  }
  
  // 朴素按钮
  &.btn-plain {
    background: transparent;
    
    &.btn-primary {
      color: $color-primary;
      border-color: $color-primary;
      
      &:hover {
        background: $color-primary;
        color: $bg-color;
      }
    }
  }
  
  // 圆形按钮
  &.btn-round {
    border-radius: $border-radius-round;
  }
  
  // 圆角按钮
  &.btn-circle {
    border-radius: $border-radius-circle;
    padding: $button-padding-vertical;
  }
}

// 卡片组件样式
.card {
  @include card();
  
  .card-header {
    padding: $spacing-md $spacing-lg;
    border-bottom: 1px solid $border-color-light;
    
    .card-title {
      margin: 0;
      font-size: $font-size-large;
      font-weight: $font-weight-medium;
      color: $text-color-primary;
    }
  }
  
  .card-body {
    padding: $spacing-lg;
  }
  
  .card-footer {
    padding: $spacing-md $spacing-lg;
    border-top: 1px solid $border-color-light;
    background: $bg-color-light;
  }
  
  // 卡片变体
  &.card-shadow {
    box-shadow: $box-shadow-lg;
  }
  
  &.card-bordered {
    border: 2px solid $border-color;
  }
  
  &.card-hover {
    @include hover-lift();
  }
}

// 标签组件样式
.tag {
  display: inline-flex;
  align-items: center;
  padding: $tag-padding;
  height: $tag-height;
  font-size: $tag-font-size;
  line-height: 1;
  border-radius: $tag-border-radius;
  border: 1px solid transparent;
  white-space: nowrap;
  
  // 标签类型
  &.tag-primary {
    background: $color-primary-light-9;
    color: $color-primary;
    border-color: $color-primary-light-8;
  }
  
  &.tag-success {
    background: $color-success-light-9;
    color: $color-success;
    border-color: $color-success-light-8;
  }
  
  &.tag-warning {
    background: $color-warning-light-9;
    color: $color-warning;
    border-color: $color-warning-light-8;
  }
  
  &.tag-danger {
    background: $color-danger-light-9;
    color: $color-danger;
    border-color: $color-danger-light-8;
  }
  
  &.tag-info {
    background: $color-info-light-9;
    color: $color-info;
    border-color: $color-info-light-8;
  }
  
  // 标签尺寸
  &.tag-large {
    height: $tag-height + 8px;
    padding: 0 16px;
    font-size: $font-size-base;
  }
  
  &.tag-small {
    height: $tag-height - 8px;
    padding: 0 8px;
    font-size: $font-size-extra-small;
  }
  
  // 可关闭标签
  .tag-close {
    margin-left: 6px;
    cursor: pointer;
    
    &:hover {
      background: rgba(0, 0, 0, 0.1);
      border-radius: 50%;
    }
  }
}

// 徽章组件样式
.badge {
  position: relative;
  display: inline-block;
  
  .badge-content {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
    background: $color-danger;
    color: $bg-color;
    font-size: $badge-font-size;
    font-weight: $badge-font-weight;
    line-height: 1;
    padding: 2px 6px;
    border-radius: $badge-size / 2;
    min-width: $badge-size;
    height: $badge-size;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    
    &.is-dot {
      width: 8px;
      height: 8px;
      padding: 0;
      border-radius: 50%;
    }
  }
}

// 头像组件样式
.avatar {
  display: inline-block;
  position: relative;
  overflow: hidden;
  background: $bg-color-light;
  color: $text-color-secondary;
  
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  // 头像尺寸
  &.avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    font-size: 24px;
  }
  
  &.avatar-default {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    font-size: 16px;
  }
  
  &.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 14px;
  }
  
  // 圆形头像
  &.avatar-circle {
    border-radius: 50%;
  }
}

// 分割线组件样式
.divider {
  margin: $spacing-lg 0;
  border: none;
  border-top: 1px solid $border-color-light;
  
  &.divider-vertical {
    display: inline-block;
    width: 1px;
    height: 1em;
    margin: 0 $spacing-sm;
    vertical-align: middle;
    border-top: none;
    border-left: 1px solid $border-color-light;
  }
  
  &.divider-dashed {
    border-top-style: dashed;
  }
}

// 加载组件样式
.loading {
  @include loading-spinner();
  
  &.loading-large {
    @include loading-spinner(32px);
  }
  
  &.loading-small {
    @include loading-spinner(16px);
  }
}

// 空状态组件样式
.empty {
  padding: $empty-padding;
  text-align: center;
  
  .empty-image {
    width: $empty-image-size;
    height: $empty-image-size;
    margin: 0 auto;
    
    img,
    svg {
      width: 100%;
      height: 100%;
    }
  }
  
  .empty-description {
    margin-top: $empty-description-margin-top;
    color: $text-color-secondary;
    font-size: $font-size-base;
  }
  
  .empty-actions {
    margin-top: $spacing-lg;
  }
}

// 结果页组件样式
.result {
  padding: $result-padding;
  text-align: center;
  
  .result-icon {
    font-size: $result-icon-font-size;
    margin-bottom: $spacing-lg;
    
    &.result-success {
      color: $color-success;
    }
    
    &.result-error {
      color: $color-danger;
    }
    
    &.result-warning {
      color: $color-warning;
    }
    
    &.result-info {
      color: $color-info;
    }
  }
  
  .result-title {
    font-size: $result-title-font-size;
    font-weight: $font-weight-medium;
    margin-bottom: $spacing-sm;
    color: $text-color-primary;
  }
  
  .result-subtitle {
    margin-top: $result-subtitle-margin-top;
    color: $text-color-secondary;
    font-size: $font-size-base;
  }
  
  .result-extra {
    margin-top: $result-extra-margin-top;
  }
}

// 统计数值组件样式
.statistic {
  .statistic-title {
    font-size: $statistic-title-font-size;
    color: $text-color-secondary;
    margin-bottom: $spacing-xs;
  }
  
  .statistic-content {
    font-size: $statistic-content-font-size;
    font-weight: $statistic-content-font-weight;
    color: $text-color-primary;
    
    .statistic-prefix,
    .statistic-suffix {
      font-size: $font-size-base;
      margin: 0 4px;
    }
  }
}

// 进度条组件样式
.progress {
  .progress-bar {
    height: $progress-height;
    background: $bg-color-light;
    border-radius: $progress-border-radius;
    overflow: hidden;
    
    .progress-inner {
      height: 100%;
      background: $color-primary;
      border-radius: $progress-border-radius;
      transition: width 0.3s ease;
    }
  }
  
  .progress-text {
    font-size: $progress-font-size;
    color: $text-color-secondary;
    margin-left: $spacing-sm;
  }
}

// 时间轴组件样式
.timeline {
  .timeline-item {
    position: relative;
    padding-bottom: $timeline-item-padding;
    
    &:not(:last-child) {
      &::before {
        content: '';
        position: absolute;
        left: $timeline-dot-size / 2 - $timeline-line-width / 2;
        top: $timeline-dot-size + 8px;
        bottom: 0;
        width: $timeline-line-width;
        background: $timeline-node-color;
      }
    }
    
    .timeline-dot {
      position: absolute;
      left: 0;
      top: 4px;
      width: $timeline-dot-size;
      height: $timeline-dot-size;
      border-radius: 50%;
      background: $bg-color;
      border: 2px solid $timeline-node-color;
      
      &.timeline-dot-primary {
        border-color: $color-primary;
      }
      
      &.timeline-dot-success {
        border-color: $color-success;
      }
      
      &.timeline-dot-warning {
        border-color: $color-warning;
      }
      
      &.timeline-dot-danger {
        border-color: $color-danger;
      }
    }
    
    .timeline-content {
      margin-left: $timeline-dot-size + $spacing-md;
      
      .timeline-title {
        font-weight: $font-weight-medium;
        color: $text-color-primary;
        margin-bottom: $spacing-xs;
      }
      
      .timeline-description {
        color: $text-color-secondary;
        font-size: $font-size-small;
      }
      
      .timeline-timestamp {
        color: $text-color-placeholder;
        font-size: $font-size-extra-small;
        margin-top: $spacing-xs;
      }
    }
  }
}

// 步骤条组件样式
.steps {
  @include flex(row, space-between, center);
  
  .step-item {
    @include flex(column, center, center);
    flex: 1;
    position: relative;
    
    &:not(:last-child) {
      &::after {
        content: '';
        position: absolute;
        top: 16px;
        left: 50%;
        width: 100%;
        height: 1px;
        background: $border-color-light;
        z-index: 1;
      }
    }
    
    .step-icon {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: $bg-color-light;
      border: 2px solid $border-color;
      @include flex(row, center, center);
      font-size: $font-size-small;
      color: $text-color-secondary;
      position: relative;
      z-index: 2;
      
      &.step-active {
        background: $color-primary;
        border-color: $color-primary;
        color: $bg-color;
      }
      
      &.step-finished {
        background: $color-success;
        border-color: $color-success;
        color: $bg-color;
      }
    }
    
    .step-title {
      margin-top: $spacing-sm;
      font-size: $font-size-small;
      color: $text-color-secondary;
      text-align: center;
      
      &.step-active {
        color: $color-primary;
        font-weight: $font-weight-medium;
      }
    }
  }
}

// 骨架屏组件样式
.skeleton {
  .skeleton-item {
    background: linear-gradient(90deg, $skeleton-color 25%, $skeleton-to-color 50%, $skeleton-color 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: $border-radius-base;
    
    &.skeleton-text {
      height: 16px;
      margin-bottom: 8px;
      
      &:last-child {
        width: 60%;
      }
    }
    
    &.skeleton-title {
      height: 20px;
      margin-bottom: 12px;
    }
    
    &.skeleton-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
    }
    
    &.skeleton-image {
      height: 200px;
    }
    
    &.skeleton-button {
      height: 32px;
      width: 80px;
    }
  }
  
  @keyframes skeleton-loading {
    0% {
      background-position: 200% 0;
    }
    100% {
      background-position: -200% 0;
    }
  }
}

// 描述列表组件样式
.descriptions {
  .descriptions-header {
    padding: $descriptions-header-padding;
    border-bottom: 1px solid $border-color-light;
    
    .descriptions-title {
      font-size: $descriptions-title-font-size;
      font-weight: $font-weight-medium;
      color: $text-color-primary;
      margin: 0;
    }
  }
  
  .descriptions-body {
    .descriptions-row {
      border-bottom: 1px solid $border-color-lighter;
      
      &:last-child {
        border-bottom: none;
      }
    }
    
    .descriptions-item {
      padding: $descriptions-item-padding;
      vertical-align: top;
      
      .descriptions-label {
        font-weight: $font-weight-medium;
        color: $text-color-regular;
        
        &::after {
          content: ':';
          margin: $descriptions-item-trailing-colon-margin;
        }
      }
      
      .descriptions-content {
        color: $text-color-primary;
      }
    }
  }
}